package com.wm.wmim.connect.center.rpc.impl;

import com.wm.wmim.common.dto.RpcRespDTO;
import com.wm.wmim.connect.center.manager.RouteManager;
import com.wm.wmim.connect.center.api.bo.req.RouteDeleteReqBO;
import com.wm.wmim.connect.center.api.bo.req.RouteGetReqBO;
import com.wm.wmim.connect.center.api.bo.req.RouteSaveReqBO;
import com.wm.wmim.connect.center.api.bo.resp.RouteGetRespBO;
import com.wm.wmim.connect.center.api.rpc.RouteRpcService;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;

/**
 * @author weiming
 * @date 2025/6/12 11:40
 * @description
 */
@DubboService(version = "1.0.0")
public class RouteRpcServiceImpl implements RouteRpcService {


    @Resource
    private RouteManager routeManager;

    public RpcRespDTO saveRouteInfo(RouteSaveReqBO reqBO){
        routeManager.saveRoute(reqBO);
        return RpcRespDTO.buildSuccess();
    }

    public RpcRespDTO deleteRouteInfo(RouteDeleteReqBO reqBO){
        routeManager.deleteRoute(reqBO);
        return RpcRespDTO.buildSuccess();
    }

    public RpcRespDTO<RouteGetRespBO> getRouteInfo(RouteGetReqBO reqBO){
        RouteGetRespBO routeInfo = routeManager.getRouteInfo(reqBO.getBusinessScene(), reqBO.getUserId());
        return RpcRespDTO.buildSuccess(routeInfo);
    }
}
